﻿namespace Sidvall.WorkItemManager.Data.Entity.Entities
{
    public partial class WorkItemLog : global::Sidvall.Data.DataRowBase, global::Sidvall.WorkItemManager.Data.IWorkItemLog
    {
        #region Public Members

        #region ExecutionEndTime

        private System.DateTime _ExecutionEndTime;
        public System.DateTime ExecutionEndTime
        { 
            get
            {
                return _ExecutionEndTime;
            }
            set
            {
                _ExecutionEndTime = Sidvall.Business.ValidationManager.GetValidUniversalDateTime(value, System.DateTimeKind.Utc);
            }
        }

        #endregion
        #region ExecutionStartTime

        private System.DateTime _ExecutionStartTime;
        public System.DateTime ExecutionStartTime
        { 
            get
            {
                return _ExecutionStartTime;
            }
            set
            {
                _ExecutionStartTime = Sidvall.Business.ValidationManager.GetValidUniversalDateTime(value, System.DateTimeKind.Utc);
            }
        }

        #endregion
        #region ResultMessage

        private string _ResultMessage;
        public string ResultMessage
        { 
            get
            {
                return _ResultMessage;
            }
            set
            {
                _ResultMessage = value;
            }
        }

        #endregion
        #region WorkItemId

        private long _WorkItemId;
        public long WorkItemId
        { 
            get
            {
                return _WorkItemId;
            }
            set
            {
                _WorkItemId = value;
            }
        }

        #endregion
        #region WorkItemLogId

        private long _WorkItemLogId;
        public long WorkItemLogId
        { 
            get
            {
                return _WorkItemLogId;
            }
            set
            {
                _WorkItemLogId = value;
            }
        }

        #endregion
        #region WorkItemResultId

        private int _WorkItemResultId;
        public int WorkItemResultId
        { 
            get
            {
                return _WorkItemResultId;
            }
            set
            {
                _WorkItemResultId = value;
            }
        }

        #endregion
        
        public virtual Sidvall.WorkItemManager.Data.Entity.Entities.WorkItem WorkItem { get; set; }
        
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.WorkItemManager.Data.Entity.SystemContext.Current.EntityFacade.WorkItemLogManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.WorkItemManager.Data.Entity.SystemContext.Current.EntityFacade.WorkItemLogManager.DataRowStateIsDirty(this);
            }
        }

        #endregion

        #region IWorkItemLog Members

        System.DateTime global::Sidvall.WorkItemManager.Data.IWorkItemLog.ExecutionEndTime
        {
            get
            {
                return this._ExecutionEndTime;
            }
            set
            {
                this.ExecutionEndTime = value;
            }
        }
        System.DateTime global::Sidvall.WorkItemManager.Data.IWorkItemLog.ExecutionStartTime
        {
            get
            {
                return this._ExecutionStartTime;
            }
            set
            {
                this.ExecutionStartTime = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItemLog.ResultMessage
        {
            get
            {
                return this._ResultMessage;
            }
            set
            {
                this.ResultMessage = value;
            }
        }
        long global::Sidvall.WorkItemManager.Data.IWorkItemLog.WorkItemId
        {
            get
            {
                return this._WorkItemId;
            }
            set
            {
                this.WorkItemId = value;
            }
        }
        System.Nullable<long> global::Sidvall.WorkItemManager.Data.IWorkItemLog.WorkItemLogId
        {
            get
            {
                return this._WorkItemLogId;
            }
            set
            {
                if (value != null)
                    this.WorkItemLogId = value.Value;
            }
        }
        global::Sidvall.WorkItemManager.Workflow.WorkItemResultType global::Sidvall.WorkItemManager.Data.IWorkItemLog.WorkItemResultId
        {
            get
            {
                return (global::Sidvall.WorkItemManager.Workflow.WorkItemResultType)this._WorkItemResultId;
            }
            set
            {
                this.WorkItemResultId = (int)value;
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        IWorkItem global::Sidvall.WorkItemManager.Data.IWorkItemLog.WorkItem
        {
            get
            {
                return this.WorkItem;
            }
            set
            {
                this.WorkItem = value as WorkItem;
            }
        }

        #endregion

        #endregion
        #region Constructors

        public WorkItemLog() : this(false, null, null)
        {
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public WorkItemLog(bool initializeChildren, Sidvall.Data.IDataRowContextProvider context, Sidvall.Data.DataRowState? dataRowState)
        {
            if ((context != null) || (dataRowState != null))
                SetDataRowContext(context, dataRowState);
            if (initializeChildren)
            {
            }
        }

        #endregion
    }
}